nodemon cannot 运行 from shell (find module error 'got') OSX capitan 10.11.3
nodemon cannot run from shell (find module error 'got') OSX capitan 10.11.3
运行 OSX 船长 10.11.3
最近 return 进行了 Node 开发(大约 3 个月后),结果发现 Nodemon 不再在我的系统上运行。例如执行以下命令:
nodemon -v
将return这个错误堆栈:
module.js:341
throw err;
^
Error: Cannot find module 'got'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/index.js:2:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
我已经尝试重新安装 nodemon 并完全重新安装 node.js。
npm uninstall -g nodemon
npm install -g nodemon
我在 package.json /usr/local/lib/node_modules/nodemon
中没有看到 'got' 的任何依赖项
{
"name": "nodemon",
"homepage": "http://nodemon.io",
"author": {
"name": "Remy Sharp",
"url": "http://github.com/remy"
},
"bin": {
"nodemon": "./bin/nodemon.js"
},
"engines": {
"node": ">=0.8"
},
"repository": {
"type": "git",
"url": "git+https://github.com/remy/nodemon.git"
},
"description": "Simple monitor script for use during development of a node.js app.",
"keywords": [
"monitor",
"development",
"restart",
"autoload",
"reload",
"terminal"
],
"preferGlobal": "true",
"license": "MIT",
"main": "./lib/nodemon",
"scripts": {
"coverage": "istanbul cover _mocha -- --timeout 30000 --ui bdd --reporter list test/**/*.test.js",
"lint": "jscs lib/**/*.js -v",
":spec": "mocha --timeout 30000 --ui bdd test/**/*.test.js",
"test": "npm run lint && npm run spec",
"spec": "for FILE in test/**/*.test.js; do echo $FILE; ./node_modules/.bin/mocha --timeout 30000 $FILE; if [ $? -ne 0 ]; then exit 1; fi; sleep 1; done",
"web": "node web",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"devDependencies": {
"async": "1.4.2",
"coffee-script": "~1.7.1",
"connect": "~2.19.1",
"istanbul": "~0.2.10",
"jscs": "2.1.1",
"mocha": "2.3.3",
"should": "~4.0.0",
"semantic-release": "4.3.5"
},
"dependencies": {
"chokidar": "^1.2.0",
"debug": "^2.2.0",
"es6-promise": "^3.0.2",
"lodash.defaults": "^3.1.2",
"minimatch": "^3.0.0",
"ps-tree": "^1.0.1",
"touch": "1.0.0",
"undefsafe": "0.0.3",
"update-notifier": "0.5.0"
},
"version": "1.8.1",
"gitHead": "b292ae74b7c43407a52ce2d33d36ff218f4245ed",
"bugs": {
"url": "https://github.com/remy/nodemon/issues"
},
"_id": "nodemon@1.8.1",
"_shasum": "75cfd7ac167e938cdab7313c839bc45a1859bb32",
"_from": "nodemon@*",
"_npmVersion": "2.14.9",
"_nodeVersion": "4.2.1",
"_npmUser": {
"name": "remy",
"email": "remy@leftlogic.com"
},
"dist": {
"shasum": "75cfd7ac167e938cdab7313c839bc45a1859bb32",
"tarball": "http://registry.npmjs.org/nodemon/-/nodemon-1.8.1.tgz"
},
"maintainers": [
{
"name": "remy",
"email": "remy@remysharp.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.8.1.tgz"
}
还有位于 usr/local/bin
的 nodemon.js 文件
#!/usr/bin/env node
'use strict';
var cli = require('../lib/cli');
var nodemon = require('../lib/');
var options = cli.parse(process.argv);
nodemon(options);
var fs = require('fs');
// checks for available update and returns an instance
var defaults = require('lodash.defaults');
var pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
require('update-notifier')({
pkg: defaults(pkg, { version: '0.0.0' }),
}).notify();
我最近关注 this answer from user Passy 使用以下两个命令获得对我的全局安装包的权限:
echo 'prefix = ~/.node' >> ~/.npmrc
export PATH="$PATH:$HOME/.node/bin"
这是我的前几行。bash_profile
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:$PATH
export PATH="$PATH:$HOME/.node/bin"
在那里设置两条线有意义吗?这里是相当新手的编码器,所以我提前道歉。已经广泛搜索了关于这个的解决方案,但我找不到任何有用的东西,所以就这样吧!将定期检查以编辑问题。
这里有一个 hack 可以提供帮助(npm3 可能遗漏了一个依赖项):
cd /usr/local/lib/node_modules/nodemon
npm install got
运行 OSX 船长 10.11.3
最近 return 进行了 Node 开发(大约 3 个月后),结果发现 Nodemon 不再在我的系统上运行。例如执行以下命令:
nodemon -v
将return这个错误堆栈:
module.js:341
throw err;
^
Error: Cannot find module 'got'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/index.js:2:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
我已经尝试重新安装 nodemon 并完全重新安装 node.js。
npm uninstall -g nodemon
npm install -g nodemon
我在 package.json /usr/local/lib/node_modules/nodemon
中没有看到 'got' 的任何依赖项{
"name": "nodemon",
"homepage": "http://nodemon.io",
"author": {
"name": "Remy Sharp",
"url": "http://github.com/remy"
},
"bin": {
"nodemon": "./bin/nodemon.js"
},
"engines": {
"node": ">=0.8"
},
"repository": {
"type": "git",
"url": "git+https://github.com/remy/nodemon.git"
},
"description": "Simple monitor script for use during development of a node.js app.",
"keywords": [
"monitor",
"development",
"restart",
"autoload",
"reload",
"terminal"
],
"preferGlobal": "true",
"license": "MIT",
"main": "./lib/nodemon",
"scripts": {
"coverage": "istanbul cover _mocha -- --timeout 30000 --ui bdd --reporter list test/**/*.test.js",
"lint": "jscs lib/**/*.js -v",
":spec": "mocha --timeout 30000 --ui bdd test/**/*.test.js",
"test": "npm run lint && npm run spec",
"spec": "for FILE in test/**/*.test.js; do echo $FILE; ./node_modules/.bin/mocha --timeout 30000 $FILE; if [ $? -ne 0 ]; then exit 1; fi; sleep 1; done",
"web": "node web",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"devDependencies": {
"async": "1.4.2",
"coffee-script": "~1.7.1",
"connect": "~2.19.1",
"istanbul": "~0.2.10",
"jscs": "2.1.1",
"mocha": "2.3.3",
"should": "~4.0.0",
"semantic-release": "4.3.5"
},
"dependencies": {
"chokidar": "^1.2.0",
"debug": "^2.2.0",
"es6-promise": "^3.0.2",
"lodash.defaults": "^3.1.2",
"minimatch": "^3.0.0",
"ps-tree": "^1.0.1",
"touch": "1.0.0",
"undefsafe": "0.0.3",
"update-notifier": "0.5.0"
},
"version": "1.8.1",
"gitHead": "b292ae74b7c43407a52ce2d33d36ff218f4245ed",
"bugs": {
"url": "https://github.com/remy/nodemon/issues"
},
"_id": "nodemon@1.8.1",
"_shasum": "75cfd7ac167e938cdab7313c839bc45a1859bb32",
"_from": "nodemon@*",
"_npmVersion": "2.14.9",
"_nodeVersion": "4.2.1",
"_npmUser": {
"name": "remy",
"email": "remy@leftlogic.com"
},
"dist": {
"shasum": "75cfd7ac167e938cdab7313c839bc45a1859bb32",
"tarball": "http://registry.npmjs.org/nodemon/-/nodemon-1.8.1.tgz"
},
"maintainers": [
{
"name": "remy",
"email": "remy@remysharp.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.8.1.tgz"
}
还有位于 usr/local/bin
的 nodemon.js 文件 #!/usr/bin/env node
'use strict';
var cli = require('../lib/cli');
var nodemon = require('../lib/');
var options = cli.parse(process.argv);
nodemon(options);
var fs = require('fs');
// checks for available update and returns an instance
var defaults = require('lodash.defaults');
var pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
require('update-notifier')({
pkg: defaults(pkg, { version: '0.0.0' }),
}).notify();
我最近关注 this answer from user Passy 使用以下两个命令获得对我的全局安装包的权限:
echo 'prefix = ~/.node' >> ~/.npmrc
export PATH="$PATH:$HOME/.node/bin"
这是我的前几行。bash_profile
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:$PATH
export PATH="$PATH:$HOME/.node/bin"
在那里设置两条线有意义吗?这里是相当新手的编码器,所以我提前道歉。已经广泛搜索了关于这个的解决方案,但我找不到任何有用的东西,所以就这样吧!将定期检查以编辑问题。
这里有一个 hack 可以提供帮助(npm3 可能遗漏了一个依赖项):
cd /usr/local/lib/node_modules/nodemon
npm install got