i think i have a short question.
我想我有一个简短的问题。
I can't find anything in the www. if i run npm install
on a windows machine to install my dependencies. is it possible to move the node_module
directory to a linux machine and run my nodejs script, or is npm checking before installing my os and choose other install path's?
我在www中找不到任何东西。如果我在Windows机器上运行npm install来安装我的依赖项。是否可以将node_module目录移动到linux机器并运行我的nodejs脚本,或者在安装我的操作系统之前进行npm检查并选择其他安装路径?
greetings mok
问候莫
2 个解决方案
#1
4
Yes, there can be differences, say, if you (or your dependencies) use native node.js addons, which are built e.g. by node-gyp and contain native binary code. Also there can be OS/CPU - specific stuff in package.json
.
是的,例如,如果您(或您的依赖项)使用本机node.js插件,可能存在差异,例如,通过node-gyp并包含本机二进制代码。在package.json中也可以有OS / CPU特定的东西。
package.json description can be found here: https://docs.npmjs.com/files/package.json
package.json描述可以在这里找到:https://docs.npmjs.com/files/package.json
#2
0
There shouldn't be a difference between the npm i
command between linux and windows.
linux和windows之间的npm i命令应该没有区别。
You should also never try to move the node_modules file. Normally in your project when you run npm init
you will have a package.json
file. This package.json
file holds all the dependencies and devdependencies. If you then run npm i
a new node_modules will be created with all the corresponding dependencies specified in the package.json
file.
您也应该永远不要尝试移动node_modules文件。通常在运行npm init的项目中,您将拥有一个package.json文件。这个package.json文件包含所有依赖项和devdependencies。如果然后运行npm i,将创建一个新的node_modules,其中包含package.json文件中指定的所有相应依赖项。
#1
4
Yes, there can be differences, say, if you (or your dependencies) use native node.js addons, which are built e.g. by node-gyp and contain native binary code. Also there can be OS/CPU - specific stuff in package.json
.
是的,例如,如果您(或您的依赖项)使用本机node.js插件,可能存在差异,例如,通过node-gyp并包含本机二进制代码。在package.json中也可以有OS / CPU特定的东西。
package.json description can be found here: https://docs.npmjs.com/files/package.json
package.json描述可以在这里找到:https://docs.npmjs.com/files/package.json
#2
0
There shouldn't be a difference between the npm i
command between linux and windows.
linux和windows之间的npm i命令应该没有区别。
You should also never try to move the node_modules file. Normally in your project when you run npm init
you will have a package.json
file. This package.json
file holds all the dependencies and devdependencies. If you then run npm i
a new node_modules will be created with all the corresponding dependencies specified in the package.json
file.
您也应该永远不要尝试移动node_modules文件。通常在运行npm init的项目中,您将拥有一个package.json文件。这个package.json文件包含所有依赖项和devdependencies。如果然后运行npm i,将创建一个新的node_modules,其中包含package.json文件中指定的所有相应依赖项。