我正在看一些同事写的代码,她@在require语句中使用了这个符号.这是其中一个文件的第一行:
var restServer = require('@company/config')
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此代码时,出现错误:
Error: Cannot find module '@company/config'
我坦率地预计,在我的目录中没有任何东西看起来像需要识别!看起来这里有一些魔法,我讨厌.
我可以猜到的是,这是一些我没有接触到的一些模糊的npm或Node技巧,或者可能是我没有得到的其他一些黑暗的配置艺术.任何信息都会受到赞赏,即使这只是对@需要如何工作的解释.
其他想法:厨师涉及到整个事情的某个地方,所以这可能是相关的.
更新:99%肯定这是一个问题,npm config在这一点上的工作方式,但仍然不确定如何修复它.
Update2基于我发现的一些东西:
Dereks-MacBook-Pro:project-dir derekjanni$ npm config set //registry.npmjs.org/:authtoken $SECRET_TOKEN
Dereks-MacBook-Pro:project-dir derekjanni$ npm install
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/5.5.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.5.0
npm ERR! npm v3.5.3
npm ERR! code E404
npm ERR! 404 Not found : @company/config
npm ERR! 404 '@company/config' is not in the npm registry.
Run Code Online (Sandbox Code Playgroud)