永远 运行 `npm start` 找不到 '/package.json'
Forever run `npm start` can't find '/package.json'
我正在尝试 运行 npm start
并永远保持 运行ning。因此,我执行了以下命令 forever -c "npm start" /home/deploy/frontend
,其中提供的路径指向我的 Angular 2 应用程序的源文件夹。
当我 运行 npm start
在该文件夹中时,一个精简服务器启动并且一切正常。但是,使用此命令,它会尝试访问 /package.json
,但由于我在 Linux 上 运行,这不会导致 ..../frontend/package.json
,而只会导致 /package.json
.
是否有某种方法可以将 forever
配置为 运行 来自我的 /home/deploy/frontend/package.json
的脚本?
日志(刚刚删除了 3 次尝试中的 1 次):
: /home/deploy/frontend:28134 - error: Script restart attempt #3
data: /home/deploy/frontend:28134 - npm ERR! Linux 4.4.0-72-generic
data: /home/deploy/frontend:28134 - npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" "/home/deploy/frontend"
data: /home/deploy/frontend:28134 - npm ERR! node v7.10.0
data: /home/deploy/frontend:28134 - npm ERR! npm v4.2.0
data: /home/deploy/frontend:28134 - npm ERR! path /package.json
data: /home/deploy/frontend:28134 - npm ERR! code ENOENT
data: /home/deploy/frontend:28134 - npm ERR! errno -2
data: /home/deploy/frontend:28134 - npm ERR! syscall open
data: /home/deploy/frontend:28134 - npm ERR! enoent ENOENT: no such file or directory, open '/package.json'
data: /home/deploy/frontend:28134 - npm ERR! enoent ENOENT: no such file or directory, open '/package.json'
data: /home/deploy/frontend:28134 - npm ERR! enoent This is most likely not a problem with npm itself
data: /home/deploy/frontend:28134 - npm ERR! enoent and is related to npm not being able to find a file.
data: /home/deploy/frontend:28134 - npm ERR! enoent
data: /home/deploy/frontend:28134 - npm ERR! Please include the following file with any support request:
data: /home/deploy/frontend:28134 - npm ERR! /root/.npm/_logs/2017-06-19T08_39_29_496Z-debug.log
data: /home/deploy/frontend:28134 - error: Forever detected script exited with code: 254
尝试执行:
forever start -c "npm start" /home/deploy/frontend/
或者,如果失败,从您的应用程序目录:
forever start -c "npm start" ./
当您在具有相同项目或包名称的文件夹中创建项目时会出现此问题。尝试在不同的文件夹中创建项目,以便 React 框架可以在构建
时查找 package.json 文件
我正在尝试 运行 npm start
并永远保持 运行ning。因此,我执行了以下命令 forever -c "npm start" /home/deploy/frontend
,其中提供的路径指向我的 Angular 2 应用程序的源文件夹。
当我 运行 npm start
在该文件夹中时,一个精简服务器启动并且一切正常。但是,使用此命令,它会尝试访问 /package.json
,但由于我在 Linux 上 运行,这不会导致 ..../frontend/package.json
,而只会导致 /package.json
.
是否有某种方法可以将 forever
配置为 运行 来自我的 /home/deploy/frontend/package.json
的脚本?
日志(刚刚删除了 3 次尝试中的 1 次):
: /home/deploy/frontend:28134 - error: Script restart attempt #3
data: /home/deploy/frontend:28134 - npm ERR! Linux 4.4.0-72-generic
data: /home/deploy/frontend:28134 - npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" "/home/deploy/frontend"
data: /home/deploy/frontend:28134 - npm ERR! node v7.10.0
data: /home/deploy/frontend:28134 - npm ERR! npm v4.2.0
data: /home/deploy/frontend:28134 - npm ERR! path /package.json
data: /home/deploy/frontend:28134 - npm ERR! code ENOENT
data: /home/deploy/frontend:28134 - npm ERR! errno -2
data: /home/deploy/frontend:28134 - npm ERR! syscall open
data: /home/deploy/frontend:28134 - npm ERR! enoent ENOENT: no such file or directory, open '/package.json'
data: /home/deploy/frontend:28134 - npm ERR! enoent ENOENT: no such file or directory, open '/package.json'
data: /home/deploy/frontend:28134 - npm ERR! enoent This is most likely not a problem with npm itself
data: /home/deploy/frontend:28134 - npm ERR! enoent and is related to npm not being able to find a file.
data: /home/deploy/frontend:28134 - npm ERR! enoent
data: /home/deploy/frontend:28134 - npm ERR! Please include the following file with any support request:
data: /home/deploy/frontend:28134 - npm ERR! /root/.npm/_logs/2017-06-19T08_39_29_496Z-debug.log
data: /home/deploy/frontend:28134 - error: Forever detected script exited with code: 254
尝试执行:
forever start -c "npm start" /home/deploy/frontend/
或者,如果失败,从您的应用程序目录:
forever start -c "npm start" ./
当您在具有相同项目或包名称的文件夹中创建项目时会出现此问题。尝试在不同的文件夹中创建项目,以便 React 框架可以在构建
时查找 package.json 文件